﻿using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using IdentityOptions = Microsoft.AspNetCore.Identity.IdentityOptions;

namespace Devonline.Identity.managers
{
    public class UserManager<TUser, TGroup, TKey> : UserManager<TUser>
        where TUser : User<TKey>
        where TGroup : Group<TKey>
        where TKey : IEquatable<TKey>, IConvertible
    {
        public UserManager(IUserStore<TUser> store, IOptions<IdentityOptions> optionsAccessor, IPasswordHasher<TUser> passwordHasher, IEnumerable<IUserValidator<TUser>> userValidators, IEnumerable<IPasswordValidator<TUser>> passwordValidators, ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, IServiceProvider services, ILogger<UserManager<TUser>> logger)
            : base(store, optionsAccessor, passwordHasher, userValidators, passwordValidators, keyNormalizer, errors, services, logger)
        {
        }

        /// <summary>
        /// Gets a flag indicating whether the backing user store supports a user group.
        /// </summary>
        /// <value>
        /// true if the backing user store supports a user group, otherwise false.
        /// </value>
        public virtual bool SupportsUserGroup
        {
            get
            {
                ThrowIfDisposed();
                return Store is IUserGroupStore<TUser, TKey>;
            }
        }
    }
}
